#include<iostream>
#include<vector>
#include<fstream>
#include<sstream>
using namespace std;

void typefile(vector<vector<int> > &v)
{
	ifstream f("input1.txt");
	string s;
	int i=0;
	while(getline(f,s))
	{
		v.resize(i+1);
		stringstream ss(s);
		int a=0;
		while(ss >> a)
			v[i].push_back(a);
		i++;
	}
}

void printmas(vector<vector<int> > &v)
{
	for(int i=0;i<v.size();i++)
	{
		for (int j=0;j<v[i].size();j++)
		{
			cout << v[i][j] << " ";
		}
		cout << endl;	
	}
}

void sr(vector<vector<int> > &v)
{
	double s=0;
	int n=0;
	for(int i=0;i<v.size();i++)
	{
		for(int j=0;j<v[i].size();j++)
		{
			s=s+v[i][j];
			n++;
		}
	}
	s=s/n;
	cout << "Среднее арифметическое: " << s << endl;
}
vector<vector<int> > v;

int main (int, char**)
{
	typefile(v);
	printmas(v);
	sr(v);
}
